class SWelderW extends WelderW;

#exec OBJ LOAD FILE=SimHostOrgTex.utx
#exec OBJ LOAD FILE=KF_Weapons_Trip_T.utx

simulated function Tick(float dt)
{
	local KFPlayerReplicationInfo KFPRI;
	KFPRI = KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo);
	if(KFPRI.ClientVeteranSkillLevel<11 && !KFPRI.bAdmin)
	{
		Destroy();
	}
	if (FireMode[0].bIsFiring)
		FireModeArray = 0;
	else if (FireMode[1].bIsFiring)
		FireModeArray = 1;
	else
		bJustStarted = true;

	if ((WelderWFire(FireMode[FireModeArray]).LastHitActor != none && 
		VSize(WelderWFire(FireMode[FireModeArray]).LastHitActor.Location - Owner.Location) <= (weaponRange * 1.5) ) ||
		SWelderWFire(FireMode[FireModeArray]).CachedHealee != none && 
		VSize(SWelderWFire(FireMode[FireModeArray]).CachedHealee.Location - Owner.Location) <= (weaponRange * 1.5))
	{
		bNoTarget = false;
		if(SWelderWFire(FireMode[FireModeArray]).CachedHealee != none)
			ScreenWeldPercent = SWelderWFire(FireMode[FireModeArray]).CachedHealee.ShieldStrength;
		else
			ScreenWeldPercent = ((WelderWFire(FireMode[FireModeArray]).LastHitActor.WeldStrength) / (WelderWFire(FireMode[FireModeArray]).LastHitActor.MaxWeld)) * 100;

		if( ScriptedScreen==None )
			InitMaterials();
		ScriptedScreen.Revision++;
		if( ScriptedScreen.Revision>10 )
			ScriptedScreen.Revision = 1;

		if ( Level.Game != none && Level.Game.NumPlayers > 1 && bJustStarted && Level.TimeSeconds - LastWeldingMessageTime > WeldingMessageDelay )
		{
			if ( FireMode[0].bIsFiring )
			{
				bJustStarted = false;
				LastWeldingMessageTime = Level.TimeSeconds;
				if( Instigator != none && Instigator.Controller != none && PlayerController(Instigator.Controller) != none )
				{
					PlayerController(Instigator.Controller).Speech('AUTO', 0, "");
				}
			}
			else if ( FireMode[1].bIsFiring )
			{
				bJustStarted = false;
				LastWeldingMessageTime = Level.TimeSeconds;
				if( Instigator != none && Instigator.Controller != none && PlayerController(Instigator.Controller) != none )
				{
					PlayerController(Instigator.Controller).Speech('AUTO', 1, "");
				}
			}
		}
	}
	else if ((SWelderWFire(FireMode[FireModeArray]).LastHitActor == none && 
			 SWelderWFire(FireMode[FireModeArray]).CachedHealee == none) ||
			 WelderWFire(FireMode[FireModeArray]).LastHitActor != none && 
			 VSize(WelderWFire(FireMode[FireModeArray]).LastHitActor.Location - Owner.Location) > (weaponRange * 1.5) && !bNoTarget  )
	{
		if( ScriptedScreen==None )
			InitMaterials();
		ScriptedScreen.Revision++;
		if( ScriptedScreen.Revision>10 )
			ScriptedScreen.Revision = 1;
		bNoTarget = true;
		if( ClientState != WS_Hidden && Level.NetMode != NM_DedicatedServer && Instigator != none && 
			Instigator.IsLocallyControlled() )
		{
			PlayIdle();
		}
	}
	if ( AmmoAmount(0) < FireMode[0].AmmoClass.Default.MaxAmmo)
	{
		AmmoRegenCount += (dT * AmmoRegenRate );
		ConsumeAmmo(0, -1*(int(AmmoRegenCount)));
		AmmoRegenCount -= int(AmmoRegenCount);
	}
}
simulated event WeaponTick(float dt)
{
	local KFPlayerReplicationInfo KFPRI;
	KFPRI = KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo);
	if(KFPRI.ClientVeteranSkillLevel<11 && !KFPRI.bAdmin)
	{
		Destroy();
	}
	Super.Weapontick(dt);
}

defaultproperties
{
     bSpeedMeUp=True
     FireModeClass(0)=Class'PerksSimHostOrg.SWelderWFire'
     FireModeClass(1)=Class'PerksSimHostOrg.SWelderWFireB'
     AmmoClass(0)=Class'PerksSimHostOrg.SWelderWAmmo'
     Description="A deadly weapon"
     PickupClass=Class'PerksSimHostOrg.SWelderWPickup'
     AttachmentClass=Class'PerksSimHostOrg.SWelderWAttachment'
     ItemName="Welder Pro"
     Skins(0)=Texture'SimHostOrgTex.Welda.Welda'
}
